package com.conf;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties.Jedis;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.StringRedisTemplate;

@Configuration
public class StringRedisUtils {
    public static Jedis jedis;

    public StringRedisUtils(StringRedisTemplate stringRedisTemplate) {
        this.stringRedisTemplate = stringRedisTemplate;
    }

    public StringRedisUtils() {
    }


    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    //数据库地址

    public void setStringVal(String key, String val) {
        stringRedisTemplate.opsForValue().set(key, val);
    }

    public String getStringVal(String key) {
        return stringRedisTemplate.opsForValue().get(key);
    }

    @Order(6)
    public static StringRedisUtils connect() {
        return new StringRedisUtils();
    }


}
